window.initAutoHide = function(config) {
    setTimeout(() => {
        document.getElementById(config.elementId).style.display = 'none';
    }, config.delay);
}


// 倒计时跳转页面函数
function startCountdown(elementId, redirectUrl, delay,what) {
    let countdown = delay;
    const countdownElement = document.createElement('a');
    countdownElement.id = 'countdown';
    countdownElement.textContent = `将在 ${countdown} 秒后跳转${what}页面...`;
    document.getElementById(elementId).appendChild(countdownElement);

    const intervalId = setInterval(() => {
        countdown--;
        if (countdown >= 0) {
            countdownElement.textContent = `将在 ${countdown} 秒后跳转 ${what}页面...`;
        } else {
            clearInterval(intervalId);
            window.location.href = redirectUrl;
        }
    }, 1000);
}